/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package poker.geneticAlgorithm;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;

/**
 * This crossover class takes an unlimited amount of crossover methods and will
 * randomly pick between them.
 * 
 * 
 * @author Benjamin L. Brodie <blbrodie@gmail.com>
 */
public class RandomCrossoverType<T> implements Crossover<T>{
    List<Crossover<T>> crossovers;
    Random random;
    int numberOfCrossovers;

    /**
     * Chooses a crossover method at random.
     * 
     * 
     * @param individuals
     * @return 
     */
    public List<T> cross(List<T> individuals) {
        return crossovers.get(random.nextInt(numberOfCrossovers)).cross(individuals);
    }
    
    public RandomCrossoverType(List<Crossover<T>> crossovers){
        this.crossovers = crossovers;
        random = new Random();
        numberOfCrossovers = this.crossovers.size();
    }
    
    
    
}
